package cn.ibizlab.odoo.core.odoo_account.service.impl;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.math.BigInteger;
import java.util.Collection;

import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import cn.ibizlab.odoo.core.client.model.Iaccount_reconcile_model;
import cn.ibizlab.odoo.core.odoo_account.domain.Account_reconcile_model;
import cn.ibizlab.odoo.core.odoo_account.filter.Account_reconcile_modelSearchContext;
import cn.ibizlab.odoo.core.odoo_account.service.IAccount_reconcile_modelService;
import cn.ibizlab.odoo.util.SearchResult;
import cn.ibizlab.odoo.util.log.IBIZLog;

/**
 * 实体[请在发票和付款匹配期间创建日记账分录] 服务对象接口实现
 */
@Slf4j
@IBIZLog
@Service
public class Account_reconcile_modelServiceImpl implements IAccount_reconcile_modelService {

    @Autowired
    private cn.ibizlab.odoo.core.client.service.Iaccount_reconcile_modelClientService account_reconcile_modelClientService;

    @Override
    public Account_reconcile_model get(Integer id) {
        Iaccount_reconcile_model clientModel = account_reconcile_modelClientService.createModel();
        clientModel.setId(id);
        account_reconcile_modelClientService.get(clientModel) ;
        return this.convert2Domain(clientModel,null);
    }

    @Override
    public Account_reconcile_model get(Account_reconcile_model account_reconcile_model) {
        Account_reconcile_model retaccount_reconcile_model = this.get(account_reconcile_model.getId()) ;
    	BeanCopier copier=BeanCopier.create(retaccount_reconcile_model.getClass(), account_reconcile_model.getClass(), false);
        copier.copy(retaccount_reconcile_model, account_reconcile_model, null);
        return account_reconcile_model ;
    }

    @Override
    public void removeBatch(Collection<? extends Serializable> idList, int batchSize) {

        //account_reconcile_modelClientService.removeBatch(account_reconcile_models) ;

    }

    @Override
    public void createBatch(List<Account_reconcile_model> account_reconcile_models, int batchSize) {

                        //account_reconcile_modelClientService.createBatch(account_reconcile_models,batchSize) ;

    }

    @Override
    public void updateBatch(List<Account_reconcile_model> account_reconcile_models, int batchSize) {

        //account_reconcile_modelClientService.updateBatch(account_reconcile_models,batchSize) ;

    }

    @Override
    public boolean remove(Integer id) {
        boolean bOk = false ;
        Iaccount_reconcile_model clientModel = account_reconcile_modelClientService.createModel();
        clientModel.setId(id);
        account_reconcile_modelClientService.remove(clientModel) ;
        bOk = true ;
        return bOk ;
    }

    @Override
    public boolean create(Account_reconcile_model account_reconcile_model) {
        boolean bOk = false ;
        Iaccount_reconcile_model clientModel = this.convert2Model(account_reconcile_model,null);
        account_reconcile_modelClientService.create(clientModel) ;
        this.convert2Domain(clientModel,account_reconcile_model);
        bOk = true ;

        return bOk ;
    }

    @Override
    public boolean update(Account_reconcile_model account_reconcile_model) {
        boolean bOk = false ;
        Iaccount_reconcile_model clientModel = this.convert2Model(account_reconcile_model,null);
        account_reconcile_modelClientService.update(clientModel) ;
        this.convert2Domain(clientModel,account_reconcile_model) ;
        bOk = true;
        return bOk ;
    }

    /**
     * 查询集合 默认查询
     */
    @Override
    public Page<Account_reconcile_model> searchDefault(Account_reconcile_modelSearchContext context) {
        List<Account_reconcile_model> list = new ArrayList<Account_reconcile_model>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_reconcile_model> clientModelList = account_reconcile_modelClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_reconcile_model clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_reconcile_model>(list, context.getPageable(), clientModelList.getTotalElements());
    }


    /**
     * 根据科目查询
     */
    @Override
    public Page<Account_reconcile_model> selectByOdoo_account(Integer id){
        Account_reconcile_modelSearchContext context = new Account_reconcile_modelSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_reconcile_model> list = new ArrayList<Account_reconcile_model>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_reconcile_model> clientModelList = account_reconcile_modelClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_reconcile_model clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_reconcile_model>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据科目查询
     */
    @Override
    public Page<Account_reconcile_model> selectByOdoo_second_account(Integer id){
        Account_reconcile_modelSearchContext context = new Account_reconcile_modelSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_reconcile_model> list = new ArrayList<Account_reconcile_model>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_reconcile_model> clientModelList = account_reconcile_modelClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_reconcile_model clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_reconcile_model>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据分析账户查询
     */
    @Override
    public Page<Account_reconcile_model> selectByOdoo_analytic_account(Integer id){
        Account_reconcile_modelSearchContext context = new Account_reconcile_modelSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_reconcile_model> list = new ArrayList<Account_reconcile_model>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_reconcile_model> clientModelList = account_reconcile_modelClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_reconcile_model clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_reconcile_model>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据分析账户查询
     */
    @Override
    public Page<Account_reconcile_model> selectByOdoo_second_analytic_account(Integer id){
        Account_reconcile_modelSearchContext context = new Account_reconcile_modelSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_reconcile_model> list = new ArrayList<Account_reconcile_model>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_reconcile_model> clientModelList = account_reconcile_modelClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_reconcile_model clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_reconcile_model>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据日记账查询
     */
    @Override
    public Page<Account_reconcile_model> selectByOdoo_journal(Integer id){
        Account_reconcile_modelSearchContext context = new Account_reconcile_modelSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_reconcile_model> list = new ArrayList<Account_reconcile_model>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_reconcile_model> clientModelList = account_reconcile_modelClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_reconcile_model clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_reconcile_model>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据日记账查询
     */
    @Override
    public Page<Account_reconcile_model> selectByOdoo_second_journal(Integer id){
        Account_reconcile_modelSearchContext context = new Account_reconcile_modelSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_reconcile_model> list = new ArrayList<Account_reconcile_model>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_reconcile_model> clientModelList = account_reconcile_modelClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_reconcile_model clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_reconcile_model>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据税率查询
     */
    @Override
    public Page<Account_reconcile_model> selectByOdoo_second_tax(Integer id){
        Account_reconcile_modelSearchContext context = new Account_reconcile_modelSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_reconcile_model> list = new ArrayList<Account_reconcile_model>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_reconcile_model> clientModelList = account_reconcile_modelClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_reconcile_model clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_reconcile_model>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据税率查询
     */
    @Override
    public Page<Account_reconcile_model> selectByOdoo_tax(Integer id){
        Account_reconcile_modelSearchContext context = new Account_reconcile_modelSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_reconcile_model> list = new ArrayList<Account_reconcile_model>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_reconcile_model> clientModelList = account_reconcile_modelClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_reconcile_model clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_reconcile_model>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据公司查询
     */
    @Override
    public Page<Account_reconcile_model> selectByOdoo_company(Integer id){
        Account_reconcile_modelSearchContext context = new Account_reconcile_modelSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_reconcile_model> list = new ArrayList<Account_reconcile_model>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_reconcile_model> clientModelList = account_reconcile_modelClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_reconcile_model clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_reconcile_model>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Account_reconcile_model> selectByOdoo_create(Integer id){
        Account_reconcile_modelSearchContext context = new Account_reconcile_modelSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_reconcile_model> list = new ArrayList<Account_reconcile_model>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_reconcile_model> clientModelList = account_reconcile_modelClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_reconcile_model clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_reconcile_model>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Account_reconcile_model> selectByOdoo_write(Integer id){
        Account_reconcile_modelSearchContext context = new Account_reconcile_modelSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Account_reconcile_model> list = new ArrayList<Account_reconcile_model>();
        Page<cn.ibizlab.odoo.core.client.model.Iaccount_reconcile_model> clientModelList = account_reconcile_modelClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Iaccount_reconcile_model clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Account_reconcile_model>(list, context.getPageable(), clientModelList.getTotalElements());

    }



    public Iaccount_reconcile_model convert2Model(Account_reconcile_model domain , Iaccount_reconcile_model model) {
        if(domain == null)
            return model ;
        if(model==null){
            model = account_reconcile_modelClientService.createModel() ;
        }

         if(domain.getLabelDirtyFlag())
            model.setLabel(domain.getLabel());
         if(domain.getDisplay_nameDirtyFlag())
            model.setDisplay_name(domain.getDisplay_name());
         if(domain.get__last_updateDirtyFlag())
            model.set__last_update(domain.get__last_update());
         if(domain.getForce_tax_includedDirtyFlag())
            model.setForce_tax_included(domain.getForce_tax_included());
         if(domain.getAmount_typeDirtyFlag())
            model.setAmount_type(domain.getAmount_type());
         if(domain.getCreate_dateDirtyFlag())
            model.setCreate_date(domain.getCreate_date());
         if(domain.getForce_second_tax_includedDirtyFlag())
            model.setForce_second_tax_included(domain.getForce_second_tax_included());
         if(domain.getAuto_reconcileDirtyFlag())
            model.setAuto_reconcile(domain.getAuto_reconcile());
         if(domain.getMatch_total_amountDirtyFlag())
            model.setMatch_total_amount(domain.getMatch_total_amount());
         if(domain.getNameDirtyFlag())
            model.setName(domain.getName());
         if(domain.getMatch_journal_idsDirtyFlag())
            model.setMatch_journal_ids(domain.getMatch_journal_ids());
         if(domain.getHas_second_lineDirtyFlag())
            model.setHas_second_line(domain.getHas_second_line());
         if(domain.getIdDirtyFlag())
            model.setId(domain.getId());
         if(domain.getMatch_natureDirtyFlag())
            model.setMatch_nature(domain.getMatch_nature());
         if(domain.getSecond_amount_typeDirtyFlag())
            model.setSecond_amount_type(domain.getSecond_amount_type());
         if(domain.getMatch_labelDirtyFlag())
            model.setMatch_label(domain.getMatch_label());
         if(domain.getMatch_amount_maxDirtyFlag())
            model.setMatch_amount_max(domain.getMatch_amount_max());
         if(domain.getMatch_total_amount_paramDirtyFlag())
            model.setMatch_total_amount_param(domain.getMatch_total_amount_param());
         if(domain.getWrite_dateDirtyFlag())
            model.setWrite_date(domain.getWrite_date());
         if(domain.getSecond_amountDirtyFlag())
            model.setSecond_amount(domain.getSecond_amount());
         if(domain.getMatch_amountDirtyFlag())
            model.setMatch_amount(domain.getMatch_amount());
         if(domain.getAnalytic_tag_idsDirtyFlag())
            model.setAnalytic_tag_ids(domain.getAnalytic_tag_ids());
         if(domain.getSequenceDirtyFlag())
            model.setSequence(domain.getSequence());
         if(domain.getRule_typeDirtyFlag())
            model.setRule_type(domain.getRule_type());
         if(domain.getMatch_partner_idsDirtyFlag())
            model.setMatch_partner_ids(domain.getMatch_partner_ids());
         if(domain.getMatch_partner_category_idsDirtyFlag())
            model.setMatch_partner_category_ids(domain.getMatch_partner_category_ids());
         if(domain.getSecond_labelDirtyFlag())
            model.setSecond_label(domain.getSecond_label());
         if(domain.getMatch_partnerDirtyFlag())
            model.setMatch_partner(domain.getMatch_partner());
         if(domain.getMatch_amount_minDirtyFlag())
            model.setMatch_amount_min(domain.getMatch_amount_min());
         if(domain.getMatch_same_currencyDirtyFlag())
            model.setMatch_same_currency(domain.getMatch_same_currency());
         if(domain.getSecond_analytic_tag_idsDirtyFlag())
            model.setSecond_analytic_tag_ids(domain.getSecond_analytic_tag_ids());
         if(domain.getAmountDirtyFlag())
            model.setAmount(domain.getAmount());
         if(domain.getMatch_label_paramDirtyFlag())
            model.setMatch_label_param(domain.getMatch_label_param());
         if(domain.getWrite_uid_textDirtyFlag())
            model.setWrite_uid_text(domain.getWrite_uid_text());
         if(domain.getSecond_analytic_account_id_textDirtyFlag())
            model.setSecond_analytic_account_id_text(domain.getSecond_analytic_account_id_text());
         if(domain.getSecond_tax_id_textDirtyFlag())
            model.setSecond_tax_id_text(domain.getSecond_tax_id_text());
         if(domain.getSecond_tax_amount_typeDirtyFlag())
            model.setSecond_tax_amount_type(domain.getSecond_tax_amount_type());
         if(domain.getTax_amount_typeDirtyFlag())
            model.setTax_amount_type(domain.getTax_amount_type());
         if(domain.getJournal_id_textDirtyFlag())
            model.setJournal_id_text(domain.getJournal_id_text());
         if(domain.getSecond_journal_id_textDirtyFlag())
            model.setSecond_journal_id_text(domain.getSecond_journal_id_text());
         if(domain.getIs_tax_price_includedDirtyFlag())
            model.setIs_tax_price_included(domain.getIs_tax_price_included());
         if(domain.getSecond_account_id_textDirtyFlag())
            model.setSecond_account_id_text(domain.getSecond_account_id_text());
         if(domain.getCompany_id_textDirtyFlag())
            model.setCompany_id_text(domain.getCompany_id_text());
         if(domain.getAnalytic_account_id_textDirtyFlag())
            model.setAnalytic_account_id_text(domain.getAnalytic_account_id_text());
         if(domain.getAccount_id_textDirtyFlag())
            model.setAccount_id_text(domain.getAccount_id_text());
         if(domain.getCreate_uid_textDirtyFlag())
            model.setCreate_uid_text(domain.getCreate_uid_text());
         if(domain.getTax_id_textDirtyFlag())
            model.setTax_id_text(domain.getTax_id_text());
         if(domain.getIs_second_tax_price_includedDirtyFlag())
            model.setIs_second_tax_price_included(domain.getIs_second_tax_price_included());
         if(domain.getSecond_analytic_account_idDirtyFlag())
            model.setSecond_analytic_account_id(domain.getSecond_analytic_account_id());
         if(domain.getCompany_idDirtyFlag())
            model.setCompany_id(domain.getCompany_id());
         if(domain.getTax_idDirtyFlag())
            model.setTax_id(domain.getTax_id());
         if(domain.getSecond_account_idDirtyFlag())
            model.setSecond_account_id(domain.getSecond_account_id());
         if(domain.getSecond_journal_idDirtyFlag())
            model.setSecond_journal_id(domain.getSecond_journal_id());
         if(domain.getAnalytic_account_idDirtyFlag())
            model.setAnalytic_account_id(domain.getAnalytic_account_id());
         if(domain.getWrite_uidDirtyFlag())
            model.setWrite_uid(domain.getWrite_uid());
         if(domain.getSecond_tax_idDirtyFlag())
            model.setSecond_tax_id(domain.getSecond_tax_id());
         if(domain.getAccount_idDirtyFlag())
            model.setAccount_id(domain.getAccount_id());
         if(domain.getJournal_idDirtyFlag())
            model.setJournal_id(domain.getJournal_id());
         if(domain.getCreate_uidDirtyFlag())
            model.setCreate_uid(domain.getCreate_uid());
        return model ;
    }

    public Account_reconcile_model convert2Domain( Iaccount_reconcile_model model ,Account_reconcile_model domain) {
        if(model == null)
            return domain ;
        if(domain == null){
            domain = new Account_reconcile_model();
        }

        if(model.getLabelDirtyFlag())
            domain.setLabel(model.getLabel());
        if(model.getDisplay_nameDirtyFlag())
            domain.setDisplay_name(model.getDisplay_name());
        if(model.get__last_updateDirtyFlag())
            domain.set__last_update(model.get__last_update());
        if(model.getForce_tax_includedDirtyFlag())
            domain.setForce_tax_included(model.getForce_tax_included());
        if(model.getAmount_typeDirtyFlag())
            domain.setAmount_type(model.getAmount_type());
        if(model.getCreate_dateDirtyFlag())
            domain.setCreate_date(model.getCreate_date());
        if(model.getForce_second_tax_includedDirtyFlag())
            domain.setForce_second_tax_included(model.getForce_second_tax_included());
        if(model.getAuto_reconcileDirtyFlag())
            domain.setAuto_reconcile(model.getAuto_reconcile());
        if(model.getMatch_total_amountDirtyFlag())
            domain.setMatch_total_amount(model.getMatch_total_amount());
        if(model.getNameDirtyFlag())
            domain.setName(model.getName());
        if(model.getMatch_journal_idsDirtyFlag())
            domain.setMatch_journal_ids(model.getMatch_journal_ids());
        if(model.getHas_second_lineDirtyFlag())
            domain.setHas_second_line(model.getHas_second_line());
        if(model.getIdDirtyFlag())
            domain.setId(model.getId());
        if(model.getMatch_natureDirtyFlag())
            domain.setMatch_nature(model.getMatch_nature());
        if(model.getSecond_amount_typeDirtyFlag())
            domain.setSecond_amount_type(model.getSecond_amount_type());
        if(model.getMatch_labelDirtyFlag())
            domain.setMatch_label(model.getMatch_label());
        if(model.getMatch_amount_maxDirtyFlag())
            domain.setMatch_amount_max(model.getMatch_amount_max());
        if(model.getMatch_total_amount_paramDirtyFlag())
            domain.setMatch_total_amount_param(model.getMatch_total_amount_param());
        if(model.getWrite_dateDirtyFlag())
            domain.setWrite_date(model.getWrite_date());
        if(model.getSecond_amountDirtyFlag())
            domain.setSecond_amount(model.getSecond_amount());
        if(model.getMatch_amountDirtyFlag())
            domain.setMatch_amount(model.getMatch_amount());
        if(model.getAnalytic_tag_idsDirtyFlag())
            domain.setAnalytic_tag_ids(model.getAnalytic_tag_ids());
        if(model.getSequenceDirtyFlag())
            domain.setSequence(model.getSequence());
        if(model.getRule_typeDirtyFlag())
            domain.setRule_type(model.getRule_type());
        if(model.getMatch_partner_idsDirtyFlag())
            domain.setMatch_partner_ids(model.getMatch_partner_ids());
        if(model.getMatch_partner_category_idsDirtyFlag())
            domain.setMatch_partner_category_ids(model.getMatch_partner_category_ids());
        if(model.getSecond_labelDirtyFlag())
            domain.setSecond_label(model.getSecond_label());
        if(model.getMatch_partnerDirtyFlag())
            domain.setMatch_partner(model.getMatch_partner());
        if(model.getMatch_amount_minDirtyFlag())
            domain.setMatch_amount_min(model.getMatch_amount_min());
        if(model.getMatch_same_currencyDirtyFlag())
            domain.setMatch_same_currency(model.getMatch_same_currency());
        if(model.getSecond_analytic_tag_idsDirtyFlag())
            domain.setSecond_analytic_tag_ids(model.getSecond_analytic_tag_ids());
        if(model.getAmountDirtyFlag())
            domain.setAmount(model.getAmount());
        if(model.getMatch_label_paramDirtyFlag())
            domain.setMatch_label_param(model.getMatch_label_param());
        if(model.getWrite_uid_textDirtyFlag())
            domain.setWrite_uid_text(model.getWrite_uid_text());
        if(model.getSecond_analytic_account_id_textDirtyFlag())
            domain.setSecond_analytic_account_id_text(model.getSecond_analytic_account_id_text());
        if(model.getSecond_tax_id_textDirtyFlag())
            domain.setSecond_tax_id_text(model.getSecond_tax_id_text());
        if(model.getSecond_tax_amount_typeDirtyFlag())
            domain.setSecond_tax_amount_type(model.getSecond_tax_amount_type());
        if(model.getTax_amount_typeDirtyFlag())
            domain.setTax_amount_type(model.getTax_amount_type());
        if(model.getJournal_id_textDirtyFlag())
            domain.setJournal_id_text(model.getJournal_id_text());
        if(model.getSecond_journal_id_textDirtyFlag())
            domain.setSecond_journal_id_text(model.getSecond_journal_id_text());
        if(model.getIs_tax_price_includedDirtyFlag())
            domain.setIs_tax_price_included(model.getIs_tax_price_included());
        if(model.getSecond_account_id_textDirtyFlag())
            domain.setSecond_account_id_text(model.getSecond_account_id_text());
        if(model.getCompany_id_textDirtyFlag())
            domain.setCompany_id_text(model.getCompany_id_text());
        if(model.getAnalytic_account_id_textDirtyFlag())
            domain.setAnalytic_account_id_text(model.getAnalytic_account_id_text());
        if(model.getAccount_id_textDirtyFlag())
            domain.setAccount_id_text(model.getAccount_id_text());
        if(model.getCreate_uid_textDirtyFlag())
            domain.setCreate_uid_text(model.getCreate_uid_text());
        if(model.getTax_id_textDirtyFlag())
            domain.setTax_id_text(model.getTax_id_text());
        if(model.getIs_second_tax_price_includedDirtyFlag())
            domain.setIs_second_tax_price_included(model.getIs_second_tax_price_included());
        if(model.getSecond_analytic_account_idDirtyFlag())
            domain.setSecond_analytic_account_id(model.getSecond_analytic_account_id());
        if(model.getCompany_idDirtyFlag())
            domain.setCompany_id(model.getCompany_id());
        if(model.getTax_idDirtyFlag())
            domain.setTax_id(model.getTax_id());
        if(model.getSecond_account_idDirtyFlag())
            domain.setSecond_account_id(model.getSecond_account_id());
        if(model.getSecond_journal_idDirtyFlag())
            domain.setSecond_journal_id(model.getSecond_journal_id());
        if(model.getAnalytic_account_idDirtyFlag())
            domain.setAnalytic_account_id(model.getAnalytic_account_id());
        if(model.getWrite_uidDirtyFlag())
            domain.setWrite_uid(model.getWrite_uid());
        if(model.getSecond_tax_idDirtyFlag())
            domain.setSecond_tax_id(model.getSecond_tax_id());
        if(model.getAccount_idDirtyFlag())
            domain.setAccount_id(model.getAccount_id());
        if(model.getJournal_idDirtyFlag())
            domain.setJournal_id(model.getJournal_id());
        if(model.getCreate_uidDirtyFlag())
            domain.setCreate_uid(model.getCreate_uid());
        return domain ;
    }


}
